//
//  DBJDocDetailModel.m
//  DBJ
//
//  Created by 简楚君 on 2016/11/15.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "DBJDocDetailModel.h"
#import <YYModel.h>
#import "DBJNetworkTool.h"
@implementation DBJDocDetailModel
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{}

+(void)getDoctorListDataWithURLString:(NSString *)URLString andParameters:(NSDictionary *)parameters andSuccessBlock:(void(^)(NSArray *newsList))successBlock andErrorBlock:(void(^)(NSError *error))errorBlock{
    [[DBJNetworkTool sharedNetworkTool] POSTWithURLString:URLString parameters:parameters success:^(id responseObject) {
        // 通过key取出字典数组
        NSDictionary *jsons = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
        NSDictionary *dict = jsons[@"data"];
        DBJDocDetailModel *model = [[self alloc]init];
        //遍历字典
        [dict enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
            [model setValue:dict[key] forKey:key];
        }];
        NSArray *newsList = [NSArray arrayWithObject:model];
        if (successBlock) {
            successBlock(newsList);
        }
    } faile:^(NSError *error) {
        if (errorBlock) {
            errorBlock(error);
        }
    }];
}

@end
